from datetime import datetime

from db import db


# 创建用户信息表模型
class UserFeedback(db.Model):
    # 设置表名
    __tablename__ = 't_user_feedback'

    # 创建数据库表字段
    # db.Column(类型，约束)
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    device_id = db.Column(db.String(50), nullable=False)
    type = db.Column(db.Integer, nullable=False)
    food_name = db.Column(db.String(30), nullable=False)
    food_desc = db.Column(db.String(255), nullable=False)
    food_level = db.Column(db.Integer, nullable=False)
    created_at = db.Column(db.DateTime, default=datetime.now)

    def __repr__(self):
        return '<UserFeedback {self.name}>'
